package web.demo.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import web.demo.entity.OrderDetail;
import web.demo.entity.Orders;

public class OrdersServlet extends BaseServlet {

	public Object test(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		return null;
	}
	//显示账单列表（后台）
	public Object ordersList(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<Orders> ordersList=ordersService.getAll();
		request.setAttribute("ordersList",ordersList);
		
		return request.getRequestDispatcher("sys/order/orderList.jsp");
	}
	//显示账单详情（后台）
	public Object orderDetail(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int ordersId=Integer.parseInt(request.getParameter("ordersId"));
		List<OrderDetail> orderDetailList=orderDetailService.getOrderDetail(ordersId);
		request.setAttribute("orderDetailList",orderDetailList);
		
		return request.getRequestDispatcher("sys/order/orderDetail.jsp");
	}
}
